home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Programming / AmigaTalk / general / Set.st < prev    next >
Text File  |  2000-02-13  |  461b  |  26 lines

  1. Class Set :Collection
  2. ! list !
  3. [
  4.    new
  5.       list <- List new
  6. |  
  7.    add: newElement
  8.       (list includes: newElement)
  9.          ifFalse: [list add: newElement]
  10. |   
  11.    remove: oldElement ifAbsent: exceptionBlock
  12.       list remove: oldElement ifAbsent: exceptionBlock
  13. |    
  14.    size
  15.       ^ list size
  16. |   
  17.    occurrencesOf: anElement
  18.       ^ (list includes: anElement) ifTrue: [1] ifFalse: [0]
  19. |    
  20.    first
  21.       ^ list first
  22. |    
  23.    next
  24.       ^ list next
  25. ]
  26.